/**
 * @author hhlxy
 * @version 1.0
 * @since 2025/8/5
 */
package cn.yilongquan.service;


import cn.yilongquan.user.domain.Article;
import cn.yilongquan.user.query.ArticleQuery;
import cn.yilongquan.util.R;
import org.apache.ibatis.annotations.MapKey;

import java.util.List;
import java.util.Map;

public interface ArticleService {
    Article findById(Long id);

    List<Article> findAll();

    void add(Article article);

    void update(Article article);

    void deleteById(Long id);

    void batchDelete(List<Long> ids);

    R pageList(ArticleQuery articleQuery);

    List<Article> findRelatedByType(Long articleType, Long currentId);
    void DatatoMongoDB();

    // 新增：获取点赞数前六的文章
    List<Article> findTop6ByStarNum();
    @MapKey("tagName")
    List<Map<String, Object>> findTop5TagCount();

    int increaseReadCount(Long id);

    boolean starArticle(Long articleId, String userIp);

    int getStarNum(Long articleId);

    int unstarArticle(Long articleId, String trim);
}
